#define _CRT_SECURE_NO_WARNINGS 1 

#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int peakIndexInMountainArray(vector<int>& arr)
    {
        int left = 1, right = arr.size() - 2;
        while (left < right)
        {
            int mid = left + (right - left + 1) / 2;
            if (arr[mid] > arr[mid - 1]) left = mid;
            else right = mid - 1;
        }
        return left;
    }
};

int main()
{
    vector<int> arr;
    Solution sol;
    arr.push_back(0);
    arr.push_back(10);
    arr.push_back(5);
    arr.push_back(2);
    int ret = sol.peakIndexInMountainArray(arr);
    cout << ret << endl;
    return 0;
}